package com.biz.systembiz;

import java.util.ArrayList;
import java.util.HashMap;

import com.dao.systemDao.IUsersDao;
import com.dao.systemDao.UsersDao;

import admin.mode.AdminMode;
import base.Power;

public class UsersBiz {
	IUsersDao dao = new UsersDao();

	/**
	 * @author lcl
	 * @param 查询所有的用户
	 * **/
	public ArrayList<HashMap<String, String>> userList(Power power,
			AdminMode admin) throws Exception {

		return dao.userList(power);
	}

	/**
	 * @author lcl
	 * @param 删除用户
	 * **/
	public boolean delUser(Power power, AdminMode admin, String id)
			throws Exception {

		return dao.delUser(power, id);
	}

	/**
	 * @author lcl
	 * @param 删除多个用户
	 * **/
	public boolean delGroupUser(Power power, AdminMode admin) throws Exception {

		return dao.groupDelete(power, admin);
	}

	public HashMap<String, Object> userInfo(Power power, String user_id)
			throws Exception {
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("infolist", dao.userInfo(power, user_id));
		map.put("userinfo",
				power.getMapFromSql("select * from `users` where role_id="
						+ user_id));
		return map;
	}

	public boolean updateUser(Power power, AdminMode admin, String user_id)
			throws Exception {

		return dao.updataUser(power, user_id);
	}
}
